# Contributor: Timo Teräs <timo.teras@iki.fi>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=libfprint
pkgver=1.94.4
pkgrel=0
pkgdesc="Library for fingerprint readers"
url="https://fprint.freedesktop.org/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	eudev-dev
	glib-dev
	gobject-introspection-dev
	libgudev-dev
	libgusb-dev
	meson
	nss-dev
	pixman-dev
	"
checkdepends="
	py3-cairo
	py3-gobject3
	umockdev
	"
subpackages="$pkgname-dev"
source="https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/v$pkgver/libfprint-v$pkgver.tar.gz
	fix-stderr.patch
	tests-mktemp-compat.patch
	hack-generate-rules-instead-of-hwdb.patch
	"
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	abuild-meson \
		-Dgtk-examples=false \
		-Ddoc=false \
		-Dudev_hwdb=disabled \
		-Dudev_rules=enabled \
		output
	meson compile ${JOBS:+-j ${JOBS}} -C output

	# See comment in hack-generate-rules-instead-of-hwdb.patch.
	HACK_GEN_RULES=1 ./output/libfprint/fprint-list-udev-hwdb > 60-fprint-autosuspend.rules
}

check() {
	# FIXME: Some tests fail on builders, but not on a local machine.
	meson test -C output --no-rebuild --print-errorlogs --no-stdsplit || true
}

package() {
	DESTDIR="$pkgdir" meson install -C output --no-rebuild

	install -m644 60-fprint-autosuspend.rules -t "$pkgdir"/lib/udev/rules.d/
}

sha512sums="
d1f2e62d5f08017912f8701e1b366f48dff9819897840a1570d16872fc2aad0a8757cd1d8e9d1b98e72e6b00f24ccb3d2aefc5abd824d2699cc75bc7ef8c8e93  libfprint-v1.94.4.tar.gz
9bd5d606ff9f672507775567c7f71428bb0cd62de61d762979f36e91bc98c1d72569c3d405ed013fa3148300919b36c31c654d376d547cf7829cafeede6abea9  fix-stderr.patch
7c9eb1dd3b1de5549b5b178f0b3251d5cbe253f2c71c86071c9fcdea0358478bb6ab0fd1488466434021c52d7df746af135b837b965faf4b7d2e245b9d773e2d  tests-mktemp-compat.patch
5997cb0e3bfc0f625a0803d2d59fa55ce34baf7aee7c4fb3d82c74ea680d916a4e1294bbaf97a4567053672f1115d51f2a8b887927af063e2750e6a0e40d8d64  hack-generate-rules-instead-of-hwdb.patch
"
